-- card: 63593 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 4755 -- name: -- part 1 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=30 top=78 right=296 bottom=478 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: -- part contents for card part 1 ----- text ----- /* * FILE: graftest.c * AUTHOR: R. Gonzalez * CREATED: Aug. 5, 1990 * * Demonstrate use of Mac_Screen class. * * PROJECT CONTENTS: * screen.c, graftest.c, ANSI, oops, MacTraps */ # include "screen.h" # include # include # define PI 3.1415926 double get_input(void); main() { Mac_Screen *mac_screen; double angle, x, y, old_x, old_y, width; boolean done; mac_screen = new(Mac_Screen); mac_screen->init(); while ((width = get_input()) != 0.) { mac_screen->set_view(width, width/mac_screen->get_aspect_ratio(), width/2., width/2./mac_screen->get_aspect_ratio()); for (angle = 0.,done = FALSE ; angle < 6*PI && !done; angle+=PI/50.) { if (angle != 0.) { mac_screen->color(BLACK); mac_screen->draw_line(0.,0.,old_x,old_y); mac_screen->draw_circle(old_x,old_y,.2); } x = cos(angle); y = sin(angle); mac_screen->color(WHITE); mac_screen->draw_line(0.,0.,x,y); mac_screen->draw_circle(x,y,.2); old_x = x; old_y = y; if (mac_screen->mouse_button_is_down()) done = TRUE; } } delete(mac_screen); } double get_input(void) { double width; printf("Width of view window (between 1 and 10, 0 to quit)?\n"); scanf("%lg",&width); return width; } -- part contents for background part 4 ----- text ----- File 3 of 3. Example application of foregoing Mac_Screen class: -- part contents for background part 7 ----- text ----- 207